<h1>Listing purchases</h1>

<table class="table table-striped table-bordered" >
  <tr>
  	<th>Date</th>
    <th>User</th>
    <th></th>
  </tr>

<% @purchases.each do |purchase| %>
  <tr>
  	<td><%= purchase.created_at.strftime("%Y-%m-%d") %></td>
    <td><%= purchase.user.name %></td>
    <td><%= link_to 'Show', purchase %>
    <%= link_to 'Edit', edit_purchase_path(purchase) %>
    <%= link_to 'Destroy', purchase, method: :delete, data: { confirm: 'Are you sure?' } %></td>
  </tr>
<% end %>

</table>

<br />

<%= link_to 'New Purchase', new_purchase_path, :class => "btn btn-default"  %>
